grid: avoid a floating point exception
authorMatthias Clasen <mclasen@redhat.com>
Sat, 24 Mar 2012 21:16:47 +0000 (17:16 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 24 Mar 2012 21:19:46 +0000 (17:19 -0400)
When a homogeneous grid has no visible children, we were
accidentally doing a division by zero. Instead, just bail
out early in this case, there is nothing to allocate anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=672763

gtk/gtkgrid.c

index fdbdf7c147501086ac1a962dac26ea4c72554560..8a96e827517de31a96a0d6e93aaa2785e84003ba 100644 (file)
@@ -1020,6 +1020,9 @@ gtk_grid_request_allocate (GtkGridRequest *request,
 
   gtk_grid_request_compute_expand (request, orientation, &nonempty, &expand);
 
+  if (nonempty == 0)
+    return;
+
   linedata = &priv->linedata[orientation];
   lines = &request->lines[orientation];